use std::fmt;

#[derive(Debug)]
pub enum MathError {
    DivisionByZero,
    InvalidOperator(String),
}

impl fmt::Display for MathError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match self {
            MathError::DivisionByZero => write!(f, "Division by zero is not allowed"),
            MathError::InvalidOperator(op) => write!(f, "Invalid operator: {}", op),
        }
    }
}

impl std::error::Error for MathError {}